const docerCompose = require('./docker-compose')
const site = require('./enable-site')

const menus = [docerCompose, site]
module.exports = {
    async menus() {
        return menus.flatMap(it =>
            it.menus.map((menu, index) => {
                menu.id = it.id + ':' + index
                return menu
            })
        )
    },
    async onClick(id, ...args) {
        const [name, index] = id.split(':')
        const mudule = menus.find(it => it.id == name)
        return await mudule.menus[index].onClick(...args)
    }
}
